#ifndef SCENE_H
#define SCENE_H

#include <QDebug>
#include <QTimer>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include"role.h"
#include"background.h"


class Scene : public QGraphicsScene
{
    Q_OBJECT
public:
    explicit Scene(QObject *parent = nullptr);
    void addrandombarriers();
    void addrandomcoins();
    void addtrack();
    void addrandombananas();

    void run();
    void start();
    void stop();

    void keyPressEvent(QKeyEvent *keyEvent);
public slots:
    void collidecoin();
signals:
    void Gameover(int score);
    void collidewithcoin();

private:

    qreal random_barrier_y();
    qreal random_coin_y();
    role* Role;
    background* Background;
    int score;
    QGraphicsTextItem* scoretext;
    void showscore();

    QTimer *timer;
    QTimer *timer1;
    QTimer *timer2;

};
#endif // SCENE_H
